package com.zds.controller;

import com.zds.entity.User;
import com.zds.service.UserService;
import org.apache.ibatis.annotations.Param;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * @className:UserController
 * @date: 2025/6/10 下午4:59
 * @description:
 */
@Controller
@RequestMapping("/user")
@ResponseBody
public class UserController {
    @Autowired
    private UserService userService;
    @GetMapping("/all")
    public List<User> all() {
        return userService.findAll();
    }
    @GetMapping("/findById")
    public User findById(@Param("#id") int id) {
        User user = userService.findById(id);
        return user;
    }
}
